<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript" src="jquery-1.4.4.min.js"></script>
        <script type="text/javascript">
            function goView(num,folder){
                window.location = "viewMessage.htm?messageNumber="+num+"&folderName="+encodeURIComponent(folder);
            }
            function goPage(folder,page){
            	window.location = "listMail.htm?folderName="+
            			encodeURIComponent(folder)+"&offset="+page;
            }
            function goDelete(){
            	var str="";
            	$('[type="checkbox"][checked]').each(function(){
            		str += $(this).val()+"|";
            	});
				window.location="deleteMessage.htm?str="+str;
            }
        </script>
    </head>
    <body>
        邮件列表-->>${folderName}
        <div>
            <input type="button" value="删除" onclick="goDelete()"/>&nbsp;
            <input type="button" value="转发" onclick="goRaply()"/>
        </div>
        <table border="1" style="height: 100%;width: 100%">
            <thead>
                <tr>
                    <th>&nbsp;</th>
                    <th>编号</th>
                    <th>发件人</th>
                    <th>主题</th>
                    <th>发送时间</th>
                </tr>
            </thead>
            <tbody>
                <c:forEach var="message" items="${messages}">
                    <tr>
                        <td><input type="checkbox" value="${message.messageNumber},${message.folderName}"/></td>
                        <td>${message.messageNumber}||${message.flags}||${message.ifAttachment}</td>
                        <td>${message.from}</td>
                        <td><a href="#" onclick="goView('${message.messageNumber}','${message.folderName}')">&nbsp;${message.subject}</a></td>
                        <td>${message.sentDate}</td>
                    </tr>
                </c:forEach>
                <tr>
                	<td>
                		<div>总数量:${length }----当前页数${curPage }/${totalPage }&nbsp;&nbsp;&nbsp;
                			<c:forEach begin="1" end="${totalPage }" step="1" var="n">
                				<a href="#" onclick="goPage('${folderName }','${n }')">${n }</a>
                			</c:forEach>
                		</div>
                	</td>
                </tr>
            </tbody>
        </table>

    </body>
</html>
